home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / PIEMAN.PAS < prev    next >
Pascal/Delphi Source File  |  1988-09-02  |  3KB  |  79 lines

  1. {--------------------------------------------------------------}
  2. {                           PieMan                             }
  3. {                                                              }
  4. {              PieSlice demonstration program                  }
  5. {                                                              }
  6. {                             by Jeff Duntemann                }
  7. {                             Turbo Pascal V5.0                }
  8. {                             Last update 9/3/88               }
  9. {                                                              }
  10. {     From: COMPLETE TURBO PASCAL 5.0  by Jeff Duntemann       }
  11. {    Scott, Foresman & Co., Inc. 1988   ISBN 0-673-38355-5     }
  12. {--------------------------------------------------------------}
  13.  
  14. PROGRAM PieMan;
  15.  
  16. USES Graph;
  17.  
  18. CONST       { Fill Patterns for pie chart: }
  19.   Halftone1 : FillPatternType =
  20.               ($CC,$33,$CC,$33,$CC,$33,$CC,$33);
  21.   Halftone2 : FillPatternType =
  22.               ($AA,$55,$AA,$55,$AA,$55,$AA,$55);
  23.   Squiggles : FillPatternType =
  24.               ($94,$84,$48,$30,$00,$c1,$22,$14);
  25.   Vertical  : FillPatternType =
  26.               ($CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC);
  27.   Bricks    : FillPatternType =
  28.               ($01,$82,$44,$28,$10,$20,$40,$80);
  29.   Blocks    : FillPatternType =
  30.               ($00,$3C,$42,$42,$42,$42,$3C,$00);
  31.  
  32.  
  33. VAR
  34.   GraphDriver : Integer;
  35.   GraphMode   : Integer;
  36.   ErrorCode   : Integer;
  37.  
  38.  
  39. {$I ROUNDRCT.SRC}  { RoundedRectangle }
  40.  
  41.  
  42. BEGIN
  43.   GraphDriver := Detect;  { Let the BGI determine what board we're using }
  44.   DetectGraph(GraphDriver,GraphMode);
  45.   InitGraph(GraphDriver,GraphMode,'');
  46.   IF GraphResult <> 0 THEN
  47.     BEGIN
  48.       Writeln('>>Halted on graphics error: ',GraphErrorMsg(GraphResult));
  49.       Halt(2)
  50.     END;
  51.  
  52.   RoundedRectangle(30,30,380,260,35);  { Draw the pie graph frame }
  53.  
  54.   PieSlice(220,160,0,45,120);          { Draw the pie chart segments }
  55.   SetFillPattern(Bricks,White);
  56.   PieSlice(220,160,45,110,120);
  57.   SetFillPattern(Squiggles,White);
  58.   PieSlice(220,160,110,130,120);
  59.   SetFillPattern(Halftone1,White);
  60.   PieSlice(220,160,130,200,120);
  61.   SetFillPattern(Blocks,White);
  62.   PieSlice(220,160,200,245,120);
  63.   SetFillPattern(Halftone2,White);
  64.   PieSlice(220,160,245,295,120);
  65.   SetFillPattern(Vertical,White);
  66.   PieSlice(220,160,295,360,120);
  67.  
  68.   SetFillStyle(SolidFill,White); { Set White as fill color }
  69.   PieSlice(500,220,0,360,70);    { Draw a color-filled circle }
  70.   SetFillPattern(Bricks,White);  { Set a fill pattern }
  71.   PieSlice(500,105,0,360,70);    { Draw a pattern-filled circle }
  72.  
  73.   SetLineStyle(3,0,1); SetFillStyle(EmptyFill,White);
  74.   PieSlice(400,320,0,40,75);
  75.  
  76.   Readln;
  77.   CloseGraph;
  78. END.
  79.